package org.gap.wizards.creature;

import org.gap.wizards.combat.Attack;
import org.gap.wizards.utils.Dice;
import org.gap.wizards.utils.Persistence;

public class MeleeAttack implements Attack {

	private String name;
	private Dice dice;

	public MeleeAttack() {}

	public MeleeAttack(String name, Dice dice) {
		this.name = name;
		this.dice = dice;
	}

	@Override
	public String desiredSkillName() {
		return name;
	}

	@Override
	public int rollDamage() {
		return dice.roll();
	}
	
	@Override
	public void persist(Persistence persister) {
		persister.set("type", name);
	}
	
	@Override
	public void load(Persistence persister) {
		name = persister.getString("type");
	}
}
